package br.com.mtg.movethegarbage.game;

import br.com.mtg.movethegarbage.framework.Graphics;
import br.com.mtg.movethegarbage.graphics.Sprite;
import android.graphics.RectF;

public abstract class Entity
{
	float x, y;
	float w, h;
	Sprite entitySprite;

	public Entity(float _x, float _y, float width, float height)
	{
		x = _x;
		y = _y;
		w = width;
		h = height;
	}

	public RectF getRect()
	{
		return new RectF(x, y, x + w, y + h);
	}

	public boolean cointain(float _x, float _y)
	{
		return getRect().contains(_x, _y);
	}

	public boolean collide(RectF _rect)
	{
		return RectF.intersects(_rect, getRect());
	}

	public abstract void draw(Graphics graphics);

	public void move(float _x, float _y)
	{
		x += _x;
		y += _y;
	}

	public void moveTo(float _x, float _y)
	{
		x = _x;
		y = _y;
	}

	public void setSprite(Sprite sprite)
	{
		entitySprite = sprite;
	}
}
